<template>
  <span>
    <el-button class="filter-item" size="small" type="success" icon="search" @click="handleSearch">搜索</el-button>
    <el-button class="filter-item" size="small" type="warning" icon="refresh-left" v-if="presenter.optShow.reset" @click="resetQuery">重置</el-button>
  </span>
</template>

<script>
export default {
  data() {
    return {
      presenter: null
    }
  },
  created() {
    this.presenter = this.getPresenter()
  },
  methods: {
    getPresenter(parent = this.$parent) {
      if (parent.IS_ESJ_CRUD) {
        return parent
      } else {
        return this.getPresenter(parent.$parent)
      }
    },
    handleSearch() {
      this.presenter.handleSearch()
    },
    resetQuery() {
      this.presenter.resetQuery()
    }
  }
}
</script>
